package com.neuedu.corejava.ch10;

public  class Computer implements Comparable<Computer>{
	private String brand;
	private double price;
	public Computer() {
		super();
	}
	public Computer(String brand, double price) {
		super();
		this.brand = brand;
		this.price = price;
	}
	/**
	 * @return the brand
	 */
	public String getBrand() {
		return brand;
	}
	/**
	 * @param brand the brand to set
	 */
	public void setBrand(String brand) {
		this.brand = brand;
	}
	/**
	 * @return the price
	 */
	public double getPrice() {
		return price;
	}
	/**
	 * @param price the price to set
	 */
	public void setPrice(double price) {
		this.price = price;
	}
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "Computer [brand=" + brand + ", price=" + price + "]";
	}
	@Override
	public int compareTo(Computer o) {
		//根据品牌进行排序
		return brand.hashCode()-o.getBrand().hashCode();
	}


}
